package cn.edu.xiyou.controller;

import cn.edu.xiyou.dao.TestMapper;
import cn.edu.xiyou.pojo.TestH;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Controller
public class TestController {
    @Autowired
    private TestMapper mapper;
    @GetMapping("hello")
    public String getMsg(Model model){
        List<TestH> msgs = mapper.queryAll();
        model.addAttribute("msgs",msgs);
//        for (TestH msg : msgs) {
//            System.out.println(msg.getMsg());
//        }
        return "hello";
    }
}
